package com.lagou.session;

import com.lagou.config.XmlConfigBuilder;
import com.lagou.pojo.Configuration;

import java.io.InputStream;

/**
 * SqlSession工厂构建类
 *
 * @author Tengfei.Wang
 * @date 26/8/2020
 */
public class SqlSessionFactoryBuilder {

    public SqlSessionFactory build(InputStream inputStream) {
        //解析配置文件，生成Configuration
        Configuration configuration = new XmlConfigBuilder().parseConfig(inputStream);
        //返回默认SqlSessionFactory
        return new DefaultSqlSessionFactory(configuration);
    }
}
